<template>
  <div class='container'>

    <div class="enter_title">
      <div style='margin-left: 10px; background:#265eff;width: 70px; height: 100%;'><img
          src='@/assets/images/logo.png'
          style='width: 70px; height: 12px;'
        ></div>
      <div style='background:#265eff;width: 295px; height: 100%;'>
        <h2 style="background:#265eff;">企业通-企业复工信息上报</h2>
      </div>
    </div>
    <van-tabs
      class='van-tabs-container'
      scrollspy
      sticky
      v-model="active"
      :ellipsis=false
      title-active-color='rgba(38, 94, 255, .8)'
      color="rgba(38, 94, 255, .8)"
    >
      <van-tab
        title-style='font-size: 16px; margin-right: 20px; margin-left: 15px;'
        class='van-tabs-item'
        title="基本信息"
        name="1"
      >
        <BasicInfo
          style='margin-top: 18px'
          ref='basicInfo'
          @testName='testName'
        ></BasicInfo>
      </van-tab>
      <van-tab
        title-style='font-size: 16px; margin-right: 20px;'
        class='van-tabs-item'
        title="健康情况"
        name="2"
      >
        <PersonHealth
          style='margin-top: 18px'
          ref='personHealth'
        ></PersonHealth>
      </van-tab>
      <van-tab
        title-style='font-size: 16px; margin-right: 20px;'
        class='van-tabs-item'
        title="返程情况"
        name="3"
      >
        <PersonFlow
          style='margin-top: 8px'
          ref='personFlow'
        ></PersonFlow>
      </van-tab>
      <van-tab
        title-style='font-size: 16px; margin-right: 20px;'
        class='van-tabs-item'
        title="办公情况"
        name="4"
      >
        <TheOffice
          style='margin-top: 18px'
          ref='theOffice'
        ></TheOffice>
      </van-tab>
      <van-tab
        title-style='font-size: 16px; margin-right: 20px;'
        class='van-tabs-item'
        title="住所情况"
        name="5"
      >
        <HomeSituation
          style='margin-top: 18px'
          ref='homeSituation'
        ></HomeSituation>
      </van-tab>
    </van-tabs>
    <div class='footer'>
      <button
        v-if="countdownFlag"
        class="form-submit"
        type="submit"
        @click="submitClick"
      >提交</button>
      <button
        v-else
        class="form-submiTime"
        type="submit"
      >请在{{countdown}}秒后继续上报</button>
    </div>
  </div>
</template>

<script>
import PersonHealth from "@/components/enterprise/personHealth";
import PersonFlow from "@/components/enterprise/personFlow";
import HomeSituation from "@/components/enterprise/homeSituation";
import BasicInfo from "@/components/enterprise/basicInfo";
import TheOffice from "@/components/enterprise/theOffice";
import {
  newquestionnaireData,
  queryCityData,
  realGenData
} from "@/assets/js/service";
import Vue from "vue";
import Tab from "vant/lib/Tab";
import Tabs from "vant/lib/Tabs";
import "vant/lib/Tabs/style";
Vue.use(Tab);
Vue.use(Tabs);
export default {
  components: {
    PersonHealth,
    PersonFlow,
    BasicInfo,
    HomeSituation,
    TheOffice
  },
  data() {
    return {
      countdown: "5", //倒计时
      countdownFlag: true,
			active: 1,
			enterpriseHomeData: []
      // epidemicData: {
      //   age: 0,
      //   contactHubei: 0,
      //   contactWuhan: 0,
      //   createTime: "",
      //   currentCity: "string",
      //   currentCountry: "string",
      //   currentCounty: "string",
      //   currentLocation: "string",
      //   currentProvince: "string",
      //   currentVillage: "string",
      //   familyCountInWuhan: 0,
      //   familyNameInWuhan: "string",
      //   firstSymptomDate: "string",
      //   goToDoctor: 0,
      //   guardianIdNumber: "string",
      //   guardianName: "string",
      //   healthCondition: 0,
      //   hubeiTouchHistory: 0,
      //   id: 0,
      //   idNumber: "string",
      //   medicalHistory: "string",
      //   medicalHospital: "string",
      //   medicalResult: "string",
      //   name: "string",
      //   phone: "string",
      //   pregnant: 0,
      //   residence: "string",
      //   sex: 0,
      //   symptom: "string",
      //   toHubei: 0,
      //   toWuhan: 0,
      //   touchPersonIsolation: 0,
      //   touchPersonLocation: "string",
      //   touchPersonName: "string",
      //   touchPersonPhone: "string",
      //   visitDate: "string",
      //   visitPerson: "string",
      //   visitPersonOrg: "string",
      //   visitPersonPhone: "string",
      //   workOrg: "string",
      //   wuhanTouchHistory: 0
      // }
    };
  },
  mounted() {
		if(localStorage.getItem('enterpriseHomeData')) {
			this.enterpriseHomeData = JSON.parse(localStorage.getItem('enterpriseHomeData'))
		}  
		
    // if (localStorage.getItem("status")) {
    //   let status = JSON.parse(localStorage.getItem("status"));

    //   let personInfo = JSON.parse(localStorage.getItem(status.name));

    //   this.$refs.basicInfo.name = personInfo.name;
    //   this.$refs.basicInfo.sex = personInfo.sex;
    //   this.$refs.basicInfo.idNumber = personInfo.idNumber;
    //   this.$refs.basicInfo.phone = personInfo.phone;
    //   this.$refs.basicInfo.enterpriseCode = personInfo.enterpriseCode;
    //   this.$refs.basicInfo.enterpriseName = personInfo.enterpriseName;
    //   this.$refs.basicInfo.deptmentName = personInfo.deptmentName;
    //   this.$refs.basicInfo.job = personInfo.job;
    //   this.$refs.basicInfo.employeeCode = personInfo.employeeCode;
    //   this.$refs.basicInfo.nativePlace = personInfo.nativePlace;

    //   this.$refs.personFlow.giveBack = personInfo.otherPlaceBack;
    //   this.$refs.personFlow.residence = personInfo.goStartingPoint;
    //   if(personInfo.goVehicle){
    //   	this.$refs.personFlow.vehicle = personInfo.goVehicle.split('-')
    //   }
    //   this.$refs.personFlow.trainNumber = personInfo.goTrainNumber;
    //   this.$refs.personFlow.residenceBack = personInfo.backStartingPoint;
    //   if(personInfo.backVehicle) {
    //   	this.$refs.personFlow.Backvehicle = personInfo.backVehicle.split('-')
    //   }

    //   this.$refs.personFlow.trainNumberBack = personInfo.backTrainNumber;
    //   this.$refs.personFlow.returnDate = personInfo.returnDate;
    //   this.$refs.personFlow.leaveHabitation = personInfo.leaveHabitation;
    //   this.$refs.personFlow.leaveDate = personInfo.leaveDate;
    //   this.$refs.personFlow.toCity = personInfo.toCity;
    //   this.$refs.personFlow.back = personInfo.back;
    //   this.$refs.personFlow.backDate = personInfo.backDate;
    //   this.$refs.personFlow.touchHubei = personInfo.touchHubei;
    //   this.$refs.personFlow.beenHubei = personInfo.beenHubei;
    //   this.$refs.personFlow.beenHubeiDate = personInfo.beenHubeiDate; //去湖北时间
    //   this.$refs.personFlow.leaveHubeiDate = personInfo.leaveHubeiDate; //离开湖北时间
    //   this.$refs.personFlow.passHubei = personInfo.passHubei; //是否经停湖北
    //   this.$refs.personFlow.fourteenDayTouchWuhan =
    //     personInfo.fourteenDayTouchWuhan; //14日内是否接触过武汉来人（1是,0否）
    //   this.$refs.personFlow.fourteenDayTouchHubei =
		// 		personInfo.fourteenDayTouchHubei; //14日内是否接触过湖北来人（1是,0否）
		// 	if(personInfo.familySymptom) {
		// 		this.$refs.personFlow.backTogether = personInfo.backTogether.split(',')//一起返回的家属
		// 	}
    //   this.$refs.personFlow.familySymptom = personInfo.familySymptom; //家属身体状况（0正常，1异常）
    //   this.$refs.personFlow.reportCommittee = personInfo.reportCommittee;
    //   this.$refs.personFlow.fourteenDayIsolation =
    //     personInfo.fourteenDayIsolation; //外地返回是否做自我居家隔离14天
    //   this.$refs.personFlow.relieveDate = personInfo.relieveDate;

    //   // 健康情况
    //   this.$refs.personHealth.personnelType = personInfo.personnelType;
    //   this.$refs.personHealth.fever = personInfo.fever;
    //   this.$refs.personHealth.temperature = personInfo.temperature;

    //   this.$refs.personHealth.symptom = personInfo.symptom.split(',')
		// 	this.$refs.personHealth.remark = personInfo.remark;
		// 	this.$refs.personHealth.remnant = personInfo.remark.length;
    //   // 办公情况
    //   this.$refs.theOffice.dutyStatus = personInfo.todayOfficeSituation;
    //   this.$refs.theOffice.tdutyStatus = personInfo.torrowOfficeSituation;
    //   this.$refs.theOffice.ydutyStatus = personInfo.thirdDayOfficeSituation;
		// 	this.$refs.theOffice.postDate = personInfo.postDate;
		// 	console.log('复工时间' + 	this.$refs.theOffice.postDate)

    //   // 住所情况
    //   // let adderss = personInfo.adderss.split('/')
    //   // this.$refs.homeSituation.residence = adderss[0]
    //   // this.$refs.homeSituation.community = adderss[1]
    //   // this.$refs.homeSituation.building = adderss[2]
    //   // this.$refs.homeSituation.unit = adderss[3]
    //   // this.$refs.homeSituation.roomNumber = adderss[4]
    //   this.$refs.homeSituation.currentProvinceCode = personInfo.currentProvince;
    //   this.$refs.homeSituation.currentCityCode = personInfo.currentCity;
    //   this.$refs.homeSituation.currentCountyCode = personInfo.currentCounty;
    //   this.$refs.homeSituation.currentCountryCode = personInfo.currentCountry;
    //   this.$refs.homeSituation.currentVillageCode = personInfo.currentVillage;
    //   this.$refs.homeSituation.communityCode = personInfo.commuityCode;
    //   this.$refs.homeSituation.community = personInfo.community;
    //   this.$refs.homeSituation.building = personInfo.building;
    //   this.$refs.homeSituation.unit = personInfo.unit;
    //   this.$refs.homeSituation.roomNumber = personInfo.roomNumber;
    // }

    // 	address:this.$refs.homeSituation.residence+"/"+this.$refs.homeSituation.community+"/"+this.$refs.homeSituation.building+"/"+this.$refs.homeSituation.unit+"/"+this.$refs.homeSituation.roomNumber,//固定居住地
  },
  methods: {
    testName(name) {
      console.log(this.enterpriseHomeData)
			let arr = this.enterpriseHomeData.filter(val => {
          return JSON.parse(val).name == name;
      });

			if(arr.length>0) {
				let personInfo = JSON.parse(arr[0]);
				this.$refs.basicInfo.name = personInfo.name;

        this.$refs.basicInfo.sex = personInfo.sex;
        this.$refs.basicInfo.idNumber = personInfo.idNumber;
        this.$refs.basicInfo.phone = personInfo.phone;
        this.$refs.basicInfo.enterpriseCode = personInfo.enterpriseCode;
        this.$refs.basicInfo.enterpriseName = personInfo.enterpriseName;
        this.$refs.basicInfo.deptmentName = personInfo.deptmentName;
        this.$refs.basicInfo.job = personInfo.job;
        this.$refs.basicInfo.employeeCode = personInfo.employeeCode;
        this.$refs.basicInfo.nativePlace = personInfo.nativePlace;

        this.$refs.personFlow.giveBack = personInfo.otherPlaceBack;
        this.$refs.personFlow.residence = personInfo.goStartingPoint;
        this.$refs.personFlow.vehicle = personInfo.goVehicle.split("-");
        this.$refs.personFlow.trainNumber = personInfo.goTrainNumber;
        this.$refs.personFlow.residenceBack = personInfo.backStartingPoint;
        this.$refs.personFlow.Backvehicle = personInfo.backVehicle.split("-"); //返程交通工具 飞机、火车、大巴、自驾'
        this.$refs.personFlow.trainNumberBack = personInfo.backTrainNumber;
        this.$refs.personFlow.returnDate = personInfo.returnDate;
        this.$refs.personFlow.leaveHabitation = personInfo.leaveHabitation;
        this.$refs.personFlow.leaveDate = personInfo.leaveDate;
        this.$refs.personFlow.toCity = personInfo.toCity;
        this.$refs.personFlow.back = personInfo.back;
        this.$refs.personFlow.backDate = personInfo.backDate;
        this.$refs.personFlow.touchHubei = personInfo.touchHubei;
        this.$refs.personFlow.beenHubei = personInfo.beenHubei;
        this.$refs.personFlow.beenHubeiDate = personInfo.beenHubeiDate; //去湖北时间
        this.$refs.personFlow.leaveHubeiDate = personInfo.leaveHubeiDate; //离开湖北时间
        this.$refs.personFlow.passHubei = personInfo.passHubei; //是否经停湖北
        this.$refs.personFlow.fourteenDayTouchWuhan =
          personInfo.fourteenDayTouchWuhan; //14日内是否接触过武汉来人（1是,0否）
        this.$refs.personFlow.fourteenDayTouchHubei =
          personInfo.fourteenDayTouchHubei; //14日内是否接触过湖北来人（1是,0否）
        this.$refs.personFlow.backTogether = personInfo.backTogether.split(","); //一起返回的家属
        this.$refs.personFlow.familySymptom = personInfo.familySymptom; //家属身体状况（0正常，1异常）
        this.$refs.personFlow.reportCommittee = personInfo.reportCommittee;
        this.$refs.personFlow.fourteenDayIsolation =
          personInfo.fourteenDayIsolation; //外地返回是否做自我居家隔离14天
        this.$refs.personFlow.relieveDate = personInfo.relieveDate;

        // 健康情况
        this.$refs.personHealth.personnelType = personInfo.personnelType;
        this.$refs.personHealth.fever = personInfo.fever;
        this.$refs.personHealth.temperature = personInfo.temperature;
        this.$refs.personHealth.symptom = personInfo.symptom.split(",");
        this.$refs.personHealth.remark = personInfo.remark;
        // 办公情况
        this.$refs.theOffice.dutyStatus = personInfo.todayOfficeSituation;
        this.$refs.theOffice.tdutyStatus = personInfo.torrowOfficeSituation;
        this.$refs.theOffice.ydutyStatus = personInfo.thirdDayOfficeSituation;
        this.$refs.theOffice.postDate = personInfo.postDate;

        console.log("地址" + personInfo.adderss);
        // 住所情况
        // let adderss = personInfo.adderss
        // this.$refs.homeSituation.residence = adderss[0]
        // this.$refs.homeSituation.community = dderss[1]
        // this.$refs.homeSituation.building = dderss[2]
        // this.$refs.homeSituation.unit = dderss[3]
        // this.$refs.homeSituation.roomNumber = dderss[4]
        this.$refs.homeSituation.currentProvinceCode =
          personInfo.currentProvince;
        this.$refs.homeSituation.currentCityCode = personInfo.currentCity;
        this.$refs.homeSituation.currentCountyCode = personInfo.currentCounty;
        this.$refs.homeSituation.currentCountryCode = personInfo.currentCountry;
        this.$refs.homeSituation.currentVillageCode = personInfo.currentVillage;
        this.$refs.homeSituation.communityCode = personInfo.commuityCode;
        this.$refs.homeSituation.community = personInfo.community;
        this.$refs.homeSituation.building = personInfo.building;
        this.$refs.homeSituation.unit = personInfo.unit;
        this.$refs.homeSituation.roomNumber = personInfo.roomNumber;
			} else {
				this.$refs.basicInfo.sex = "0";
        this.$refs.basicInfo.idNumber = "";
        this.$refs.basicInfo.phone = "";
        this.$refs.basicInfo.enterpriseCode = "";
        this.$refs.basicInfo.enterpriseName = "";
        this.$refs.basicInfo.deptmentName = "";
        this.$refs.basicInfo.job = "0";
        this.$refs.basicInfo.employeeCode = "";
        this.$refs.basicInfo.nativePlace = "";
        // 名字不存在时，将籍贯清空
        this.$refs.basicInfo.nativePlaceName = '';

        this.$refs.personFlow.giveBack = "0";
        this.$refs.personFlow.residence = "";
        this.$refs.personFlow.vehicle = [];
        this.$refs.personFlow.trainNumber = "";
        this.$refs.personFlow.residenceBack = "";
        this.$refs.personFlow.Backvehicle = []; //返程交通工具 飞机、火车、大巴、自驾'
        this.$refs.personFlow.trainNumberBack = "";
        this.$refs.personFlow.returnDate = "";
        this.$refs.personFlow.leaveHabitation = "0";
        this.$refs.personFlow.leaveDate = "";
        this.$refs.personFlow.toCity = "";
        this.$refs.personFlow.back = "0";
        this.$refs.personFlow.backDate = "";
        this.$refs.personFlow.touchHubei = "0";
        this.$refs.personFlow.beenHubei = "0";
        this.$refs.personFlow.beenHubeiDate = ''; //去湖北时间
        this.$refs.personFlow.leaveHubeiDate = ""; //离开湖北时间
        this.$refs.personFlow.passHubei = "0"; //是否经停湖北
        this.$refs.personFlow.fourteenDayTouchWuhan = "0"; //14日内是否接触过武汉来人（1是,0否）
        this.$refs.personFlow.fourteenDayTouchHubei = "0"; //14日内是否接触过湖北来人（1是,0否）
        this.$refs.personFlow.backTogether = []; //一起返回的家属
        this.$refs.personFlow.familySymptom = "0"; //家属身体状况（0正常，1异常）
        this.$refs.personFlow.reportCommittee = "1";
        this.$refs.personFlow.fourteenDayIsolation = "1"; //外地返回是否做自我居家隔离14天
        this.$refs.personFlow.relieveDate = "";

        // 健康情况
        this.$refs.personHealth.personnelType = "3";
        this.$refs.personHealth.fever = "0";
        this.$refs.personHealth.temperature = "";
        this.$refs.personHealth.symptom = [];
        this.$refs.personHealth.remark = "";
        // 办公情况
        this.$refs.theOffice.dutyStatus = '1';
        this.$refs.theOffice.tdutyStatus = "1";
        this.$refs.theOffice.ydutyStatus = "1";
        this.$refs.theOffice.postDate = '';

        // 住所情况
        let adderss = "";
        this.$refs.homeSituation.residence = "";
        this.$refs.homeSituation.community = "";
        this.$refs.homeSituation.building = "";
        this.$refs.homeSituation.unit = "";
        this.$refs.homeSituation.roomNumber = "";
        this.$refs.homeSituation.currentProvinceCode = "";
        this.$refs.homeSituation.currentCityCode = "";
        this.$refs.homeSituation.currentCountyCode = "";
        this.$refs.homeSituation.currentCountryCode = "";
        this.$refs.homeSituation.currentVillageCode = "";
        this.$refs.homeSituation.communityCode = "";
        this.$refs.homeSituation.community = "";
        this.$refs.homeSituation.building = "";
        this.$refs.homeSituation.unit = "";
        this.$refs.homeSituation.roomNumber = "";
			}
 
      // if (localStorage.getItem(name)) {
      //   console.log("存在");
      //   let personInfo = JSON.parse(localStorage.getItem(name));

      //   console.log("复工日期" + personInfo.postDate + personInfo.phone);
        
      // } else {
      //   console.log("执行了改方法");
        
      // }
    },
    handleAddress(residence, community, building, unit, roomNumber) {
      let address = "";
      if (residence && typeof residence != "undefined") {
        address = residence;
      }
      if (community && typeof community != "undefined") {
        address = address + "/" + community;
      }
      if (building && typeof building != "undefined") {
        address = address + "/" + building;
      }
      if (unit && typeof unit != "undefined") {
        address = address + "/" + unit;
      }
      if (unit && typeof unit != "undefined") {
        address = address + "/" + unit;
      }
    },
    submitClick() {
			let _this = this;
      let param = {
        // 基本信息
        name: this.$refs.basicInfo.name, //姓名
        sex: this.$refs.basicInfo.sex, //性别
        idNumber: this.$refs.basicInfo.idNumber, //身份证号/护照号/其他ID号
        phone: this.$refs.basicInfo.phone, //联系电话-必填
        enterpriseCode: this.$refs.basicInfo.enterpriseCode, //单位编码
        enterpriseName: this.$refs.basicInfo.enterpriseName, //所属单位（企事业单位、高校、科研院所等名称）
        deptmentName: this.$refs.basicInfo.deptmentName, //所在一级部门（院系、所室等）
        job: this.$refs.basicInfo.job, //工作岗位（正式合同制、临时聘用）
        employeeCode: this.$refs.basicInfo.employeeCode, //人员编号
        nativePlace: this.$refs.basicInfo.nativePlace, //籍贯
        nativePlaceName:this.$refs.basicInfo.nativePlaceName, //籍贯
        // 返程情况
        otherPlaceBack: this.$refs.personFlow.giveBack, //是否外地返程(1是0否)
        goStartingPoint: this.$refs.personFlow.residence, //去程起点
        goVehicle: this.$refs.personFlow.vehicle.join("-"), //去程交通工具（飞机、火车、大巴、自驾）
        goTrainNumber: this.$refs.personFlow.trainNumber, //去时车次航班
        backStartingPoint: this.$refs.personFlow.residenceBack, //'返程起点
        backVehicle: this.$refs.personFlow.Backvehicle.join("-"), //返程交通工具 飞机、火车、大巴、自驾'
        backTrainNumber: this.$refs.personFlow.trainNumberBack, //返程车次航班
        returnDate: this.$refs.personFlow.returnDate, //返程日期
        leaveHabitation: this.$refs.personFlow.leaveHabitation, //近期是否离开固定驻地
        leaveDate: this.$refs.personFlow.leaveDate, //离开固定驻地时间
        toCity: this.$refs.personFlow.toCity, //所赴城市
        back: this.$refs.personFlow.back, //是否已返回
        backDate: this.$refs.personFlow.backDate, //返回时间
        touchHubei: this.$refs.personFlow.touchHubei, //离开期间是否与湖北地区的人员接触
        beenHubei: this.$refs.personFlow.beenHubei, //1月1日以后是否去过湖北,
        beenHubeiDate: this.$refs.personFlow.beenHubeiDate, //去湖北时间
        leaveHubeiDate: this.$refs.personFlow.leaveHubeiDate, //离开湖北时间
        passHubei: this.$refs.personFlow.passHubei, //是否经停湖北
        fourteenDayTouchWuhan: this.$refs.personFlow.fourteenDayTouchWuhan, //14日内是否接触过武汉来人（1是,0否）
        fourteenDayTouchHubei: this.$refs.personFlow.fourteenDayTouchHubei, //14日内是否接触过湖北来人（1是,0否）
        backTogether: this.$refs.personFlow.backTogether.join(","), //一起返回的家属
        familySymptom: this.$refs.personFlow.familySymptom, //家属身体状况（0正常，1异常）
        reportCommittee: this.$refs.personFlow.reportCommittee, //是否向所在社区居委会登记报到（1是,0否）
        fourteenDayIsolation: this.$refs.personFlow.fourteenDayIsolation, //外地返回是否做自我居家隔离14天
        relieveDate: this.$refs.personFlow.relieveDate, //预计解除隔离时间
        // 健康情况
        personnelType: this.$refs.personHealth.personnelType, //人群类型
        fever: this.$refs.personHealth.fever, //是否发热（>=37.3度）（1是,0否）
        temperature: this.$refs.personHealth.temperature, //体温
        symptom: this.$refs.personHealth.symptom.join(","), //其它症状
        remark: this.$refs.personHealth.remark, //其他需要报告的情况,
        // 办公情况
        todayOfficeSituation: this.$refs.theOffice.dutyStatus, //今日办公情况(1远程、2现场、3请假)
        torrowOfficeSituation: this.$refs.theOffice.tdutyStatus, //明日办公情况(1远程、2现场、3请假)
        thirdDayOfficeSituation: this.$refs.theOffice.ydutyStatus, //后天办公情况(1远程、2现场、3请假)
        postDate: this.$refs.theOffice.postDate, //预计返岗日期
        // 住所情况
        address:this.handleAddress(this.$refs.homeSituation.residence,this.$refs.homeSituation.community,this.$refs.homeSituation.building,this.$refs.homeSituation.unit,this.$refs.homeSituation.roomNumber),
		residence:this.$refs.homeSituation.residence,
		currentProvince: this.$refs.homeSituation.currentProvinceCode, //当前所在省
        currentCity: this.$refs.homeSituation.currentCityCode, //市（当前所在地）
        currentCounty: this.$refs.homeSituation.currentCountyCode, //区/县（当前所在地）
        currentCountry: this.$refs.homeSituation.currentCountryCode, //街道/乡/镇（当前所在地）
        currentVillage: this.$refs.homeSituation.currentVillageCode, //社区/村（当前所在地）
        commuityCode: this.$refs.homeSituation.communityCode, //小区编码
        community: this.$refs.homeSituation.community, //小区（详细地址）
        building: this.$refs.homeSituation.building, //楼栋
        unit: this.$refs.homeSituation.unit, //单元
        roomNumber: this.$refs.homeSituation.roomNumber //房号
      };
      console.log(param);
      if (
        _this.$verification(param.name, 0, "姓名") &&
        _this.$verification(param.nativePlace, 0, "籍贯") &&
        _this.$verification(param.phone, 0, "联系电话") &&
        _this.$verification(param.enterpriseName, 0, "所属单位")
      ) {
        let verifyflag = false;
        if (param.otherPlaceBack == "1") {
          if (
            _this.$verification(param.goStartingPoint, 0, "去程起点") &&
            _this.$verification(param.goVehicle, 0, "去程交通工具") &&
            _this.$verification(param.backStartingPoint, 0, "返程起点") &&
            _this.$verification(param.backVehicle, 0, "返程交通工具") &&
            _this.$verification(param.returnDate, 0, "返程日期")
          ) {
            if (param.leaveHabitation == "1") {
              if (
                _this.$verification(param.leaveDate, 0, "离开固定驻地时间") &&
                _this.$verification(param.toCity, 0, "所赴城市") &&
                _this.$verification(param.backDate, 0, "返回时间")
              ) {
                verifyflag = true;
              }
            } else {
              verifyflag = true;
            }
          }
        } else {
          verifyflag = true;
        }
        if (_this.$verification(param.postDate, 0, "复工日期")) {
          verifyflag = true;
        } else {
          verifyflag = false;
        }

        if (verifyflag) {
					
					if(_this.enterpriseHomeData.length > 0){
          _this.enterpriseHomeData = _this.enterpriseHomeData.filter(val => {
            return JSON.parse(val).name != param.name;
          })
				}
        _this.enterpriseHomeData.unshift(JSON.stringify(param))
        localStorage.setItem('enterpriseHomeData', JSON.stringify(_this.enterpriseHomeData));
          // localStorage.setItem(param.name, JSON.stringify(param));
          // let status = {
          //   name: param.name
          // };
          // localStorage.setItem("status", JSON.stringify(status));

          // let obj = JSON.stringify(param);
          console.log("保存成功");
          // localStorage.setItem('enterpriseHomeData', obj);
          realGenData(param, res => {
            console.log("return==>", res);
            if (res.success) {
              _this.countdownFlag = false;
              var timeId = setInterval(() => {
                _this.countdown--;
                console.log("1");
                if (_this.countdown == 0) {
                  _this.countdownFlag = true;
                  _this.countdown = 5;
                  clearInterval(timeId);
                }
              }, 1000);
              _this.$showBottomToast("上报成功");
            } else {
              _this.$showBottomToast(res.msg);
            }
          });
        }
      }
    },
    getCurrentDate() {
      const timeStr = "-";
      const curDate = new Date();
      const curYear = curDate.getFullYear(); //获取完整的年份(4位,1970-????)
      const curMonth = curDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
      const curDay = curDate.getDate(); //获取当前日(1-31)
      const curWeekDay = curDate.getDay(); //获取当前星期X(0-6,0代表星期天)
      const curHour = curDate.getHours(); //获取当前小时数(0-23)
      const curMinute = curDate.getMinutes(); // 获取当前分钟数(0-59)
      const curSec = curDate.getSeconds(); //获取当前秒数(0-59)
      const Current = curYear + timeStr + curMonth + timeStr + curDay;
      return Current;
    }
  }
};
</script>
<style lang="less" scoped>
.container {
  position: relative;
  min-height: 100%;
  width: 100%;
  background: #fff;
  padding: 0px;
}
.enter_title {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  width: 100%;
  height: 9vh;
  color: white;
  line-height: 9vh;
  text-align: center;
  background: #265eff;
}
// .mui-bar.mui-bar-nav {
//   position: relative;
//   height: 0.9rem;
//   line-height: 0.9rem;
//   font-size: 0.26rem;
//   color: #fff;
//   text-align: center;
//   background-color: rgba(38, 94, 255, .8);
// }
.van-tabs-container {
  padding-bottom: 60px;
  width: 100% !important;
}
.van-tab {
  margin-right: 10px;
  margin-left: 10px;
  padding: 0 10px !important;
}
.van-tabs-item {
  padding: 0 10px !important;
  // margin-top: 0.3rem;
  // margin-right: 0.05rem;
}
.footer {
  position: fixed;
  left: 0;
  bottom: 0.1rem;
  width: 100%;
  height: 50px;
  z-index: 100;
  .form-submit {
    width: 90%;
    margin-left: 5%;
    height: 50px;
    background: #265eff;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    border: none;
    outline: none;
  }

  .form-submiTime {
    width: 90%;
    margin-left: 5%;
    height: 50px;
    background: #228ed940;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    border: none;
    outline: none;
  }
}
</style>
